package com.fl.mybatisgenerator.demo;

import lombok.extern.slf4j.Slf4j;

/**
 * 多线程远程下载图片
 */
@Slf4j
public class demo2 implements Runnable {
    private String url;
    private String name;

    public demo2(String url, String name){
        this.url = url;
        this.name = name;
    }

    @Override
    public void run() {
        WebDownload download = new WebDownload();
        download.downloadFile(url,name);
        log.info("下载的文件名号为:{},链接为:{}",name,url);
    }

    public static void main(String[] args) {
        String url = "https://img2.baidu.com/it/u=4084621093,2971972319&fm=253&fmt=auto&app=120&f=JPEG?w=889&h=500";
        demo2 t1 = new demo2(url,"2.jpg");
        new Thread(t1).start();
    }
}

